<%--
  Created by IntelliJ IDEA.
  User: adminthy
  Date: 2018/6/17
  Time: 18:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html>
<head>
    <title>商品添加</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style type="text/css">
        body {
            font-family: "微软雅黑";
            background-color: #EDEDED;
        }

        h2 {
            text-align: center;
        }

        table {
            margin: 0 auto;
            /* width: 96%; */
            text-align: center;
            border-collapse: collapse;
        }

        td, th {
            padding: 7px;
        }

        th {
            background-color: #DCDCDC;
        }

        th.ths {
            width: 100px;
        }

        input.pnum {
            width: 80px;
            height: 25px;
            font-size: 18px;
            text-align: center;
        }

    </style>

    <!--引入jquery的js库-->
    <script src="js/jquery-1.12.4.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.css">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap-theme.css">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="bootstrap-3.3.7-dist/js/bootstrap.js"></script>
    <style>

    </style>
</head>
<body>

<div class="wrapper" style="padding: 5% 20%;">
    <h1 style="text-align: center; margin-bottom: 40px;">添加商品</h1>
    <form action="${app}/ProdAddServlet" class="form-horizontal" method="post" enctype="multipart/form-data">
        <c:if test="${not empty requestScope.errorMsg.all}">
            <p class="text-danger">${requestScope.errorMsg.all}</p>
        </c:if>

        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">商品名称</label>
            <div class="col-sm-10">
                <input name="name" type="text" class="form-control" id="input-name" placeholder="商品名称">
                <span class="text-danger">${requestScope.errorMsg.name}</span>
            </div>
        </div>
        <div class="form-group">
            <label for="input-category" class="col-sm-2 control-label">商品分类</label>
            <div class="col-sm-10">
                <select name="cid" id="input-category" class="form-control">
                    <c:forEach items="${requestScope.categoryList}" varStatus="status" var="category">
                        <option value="${category.id}">${category.name}</option>
                    </c:forEach>
                </select>
                <span class="text-danger">${requestScope.errorMsg.cid}</span>
            </div>
        </div>
        <div class="form-group">
            <label for="input-file" class="col-sm-2 control-label">商品图片</label>
            <div class="col-sm-10">
                <input name="img" type="file" id="input-file">
                <p class="help-block">请上传商品图片。</p>
                <span class="text-danger">${requestScope.errorMsg.img}</span>
            </div>
        </div>
        <div class="form-group">
            <label for="input-desc" class="col-sm-2 control-label">商品描述</label>
            <div class="col-sm-10">
                <textarea name="desc" class="form-control" id="input-desc" placeholder="商品描述" rows="5"></textarea>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10" style="text-align: right; padding-right: 10%;">
                <button type="submit" class="btn btn-default">添加</button>
            </div>
        </div>
    </form>
</div>


</body>
</html>



